//
// Created by ashCheng on 2022/12/22.
//
#include <iostream>

int main() {
  int i = 1, j = 2;
  int *pi = &i, *pj = &j;
  std::cout << "i: " << i << "; j: " << j << "; pi: " << *pi << "; pj: " << *pj << std::endl;
  //更改指针的值(以下两种方式都可以)
  pi = pj;
  pi = &j;
  std::cout << "i: " << i << "; j: " << j << "; pi: " << *pi << "; pj: " << *pj << std::endl;
  //更改指针所指对象的值(以下两种方式都可以)
  *pj = 4;
  j = 4;
  std::cout << "i: " << i << "; j: " << j << "; pi: " << *pi << "; pj: " << *pj << std::endl;
}